home *** CD-ROM | disk | FTP | other *** search
/ NeXT Education Software Sampler 1992 Fall / NeXT Education Software Sampler 1992 Fall.iso / Programming / Source / tess / tess-1.0 / cmm.m < prev    next >
Encoding:
Text File  |  1992-06-30  |  1.0 KB  |  58 lines

  1. #import "aGroup-inter.h"
  2. #import "aGroup.h"
  3. #import "cmm.h"
  4.  
  5. @implementation cmm
  6. - resizeGenerator
  7. {
  8.   latticesize.height = frame.size.height;
  9.   latticesize.width = 2.0 * frame.size.width;
  10.   upx = frame.size.width;
  11.   upy = latticesize.height ;
  12.   overx = latticesize.width;
  13.   gravy = 0.0;
  14.   gravx = frame.size.width;
  15.   return self;
  16. }
  17.  
  18. - clip: (NXCoord) x: (NXCoord) y 
  19.   PSmoveto(x,y);
  20.   PSrlineto(0,bounds.size.height);
  21.   PSrlineto(bounds.size.width,-bounds.size.height);
  22.   PSclosepath();
  23.   PSclip();
  24.   return self;
  25. }
  26.  
  27. - makeLatticeUnitAt: (NXPoint *) point fromImage: srcimg 
  28. {
  29.   id imgrep;
  30.   NXPoint pt;
  31.   
  32.   pt.x = - point->x ;
  33.   pt.y = - point->y ;
  34.   imgrep = [srcimg bestRepresentation];
  35.   PSgsave();
  36.   [self clip:0.0:0.0];
  37.   [imgrep drawAt: &pt];
  38.   PSgrestore();
  39.   PSgsave();
  40.   reflect(0.0);
  41.   [self clip:0.0:0.0];
  42.   [imgrep drawAt: &pt];
  43.   PSgrestore();
  44.   PSgsave();
  45.   reflect(90.0);
  46.   [self clip:0.0:0.0];
  47.   [imgrep drawAt: &pt];
  48.   PSgrestore();
  49.   PSgsave();
  50.   PSrotate(180.0);
  51.   [self clip:0.0:0.0];
  52.   [imgrep drawAt: &pt];
  53.   PSgrestore();
  54.   return self;
  55. }
  56. @end
  57.